# Maintainer: Morten Linderud <foxboron@archlinux.org>
# Maintainer: Robin Candau <antiz@archlinux.org>
# Contributor: Maxim Baz <$pkgname at maximbaz dot com>
# Contributor: Anatol Pomozov
# Contributor: Benjamin Chrétien <chretien + aur [at] lirmm [dot] fr>
# Contributor: Eric Engestrom <aur [at] engestrom [dot] ch>
# Contributor: Rasi <rasi@xssn.at>
# Contributor: Sean Pringle <sean.pringle@gmail.com>
# Contributor: SanskritFritz (gmail)

pkgname=rofi
pkgver=1.7.5
pkgrel=2
pkgdesc='A window switcher, application launcher and dmenu replacement'
arch=(loong64 x86_64)
url="https://github.com/DaveDavenport/$pkgname"
license=(MIT)
depends=(libxdg-basedir startup-notification libxkbcommon-x11 xcb-util-wm xcb-util-xrm librsvg xcb-util-cursor)
makedepends=(check)
optdepends=('i3-wm: use as a window switcher')
source=("$url/releases/download/$pkgver/$pkgname-$pkgver.tar.xz")
sha256sums=('caffcf66d165cb32b748c1db7f229d6d75da58c1685eb17455f65c60e8220c8d')

prepare() {
  cd "$pkgname-$pkgver"
  sed -i "s/xfce4-terminal.wrapper/xfce4-terminal/g" script/rofi-sensible-terminal
}

build() {
  cd "$pkgname-$pkgver"
  autoreconf -i
  ./configure --prefix=/usr --sysconfdir=/etc
  make
}

check() {
  cd "$pkgname-$pkgver"
  LC_ALL=C make check
}

package() {
  cd "$pkgname-$pkgver"
  make install install-man DESTDIR="$pkgdir"

  install -Dm644 COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING"
  install -dm755 "$pkgdir/usr/share/doc/$pkgname/examples"
  install -Dm755 Examples/*.sh "$pkgdir/usr/share/doc/$pkgname/examples"
}
